﻿Public Class Registro

    Private valores As New List(Of Valor)

    'http://stackoverflow.com/questions/5244991/vb-net-hashmap-equivalent
    Dim dict As New Dictionary(Of String, Valor)

    Sub agregar(ByVal columna As String, ByVal valor As String, ByVal esTexto As Boolean)
        Dim v As New Valor
        v.columna = columna
        v.valor = valor
        v.esTexto = esTexto

        valores.Add(v)
        dict.Add(columna, v)
    End Sub

    Sub agregar(ByVal columna As String, ByVal valor As String)
        agregar(columna, valor, True)
    End Sub

    Public Function getValores() As List(Of Valor)
        Return valores
    End Function

    Public Function getValor(ByVal columna As String) As String
        If dict.ContainsKey(columna) Then
            Return LTrim(RTrim(dict.Item(columna).valor))
        End If

        Return ""
    End Function

    Public Function esVacio(ByVal columna As String) As Boolean
        Return getValor(columna) = ""
    End Function
End Class
